ChatCommands = {}

GMRP.specialTalk = {}
GMRP.specialTalk["/y"] = { "(YELL)", 1000 }
GMRP.specialTalk["/w"] = { "(WHISPER)", 100 }


function GMRP.ChatCommand( name, cmd )
	
	ChatCommands[ "/"..name ] = cmd
	
end	


function GM:PlayerSay( p, text )
	
	local chat = string.Explode( " ", string.lower(text) )
	
	for k, v in pairs( ChatCommands ) do
	
		if ( chat[1] == k ) then
		
			if chat[2] != "" && chat[2] != nil then
		
				v( p, chat[2] )
				return ""
				
			else

				v( p )
				return ""
				
			end	
			
		end
		
	end	
	

	if ( string.sub( text, 1, 3 ) == "// " ) then
	
		return string.sub( text, 4 )
		
	end
	
	for k, v in pairs( GMRP.specialTalk ) do
	
		if ( string.sub( text, 1, string.len( k ) + 1 ) == k.." "  ) then
	
			p:RPTalk( GMRP.specialTalk[k][2], GMRP.specialTalk[k][1].." "..string.sub( text, string.len( k ) + 2 ) )	
			return ""
			
		end
		
	end	

	p:RPTalk( 300, text )	
	return ""	

end	


function DropMoneyChatCommand(ply, amount)

	if ( amount == nil ) then return end

	ply:ConCommand( "gm_rp_dropcash "..amount )
	
end

GMRP.ChatCommand( "drop", DropMoneyChatCommand )


function SleepChat( ply, a )

	ply:ConCommand( "gm_rp_sleep" )
	
end

GMRP.ChatCommand( "sleep", SleepChat )


function SitChat( ply, a )
	
	ply:ConCommand( "gm_rp_sit" )
	
end

GMRP.ChatCommand( "sit", SitChat )